package com.lz.football.module.activity.vip
{
	import com.common.utils.Reflection;
	import com.liangzhong.model.activity.vip.VipVo;
	import com.lz.football.module.base.IComponent;
	
	import common.BaseView.GoodItem;
	
	import flash.display.MovieClip;
	import flash.display.Sprite;
	
	public class VipItem extends Sprite implements IComponent
	{
		/**
		 * 皮肤 
		 */
		private var _skin:MovieClip;
		private var _awardVec:Vector.<GoodItem>;
		
		public function VipItem()
		{
			super();
		}
		
		public function initUI(view:Object=null):void
		{
			_skin = Reflection.createInstance("com.lz.res.activity.vipItem");
			this.addChild(_skin);
			
		}
		/**
		 *设置数据 
		 * @param $vo
		 * 
		 */
		public function setDate($vo:VipVo):void
		{
			_skin.vipLv.gotoAndStop($vo.lv);
			
			var str:String
			if($vo.buffer == null || $vo.buffer == "")
			{
				str = "buff奖励：无\n每日奖励：";
			}else
			{
				str = "buff奖励：" + $vo.buffer+ "\n每日奖励：";
			}
			var arr:Array;
			arr = $vo.daily;
			var len:int ;
			len = arr.length;
			var i:int;
			for(i= 0;i < len;i++)
			{
				str += arr[i].goods.name +"*"+arr[i].num +",";
			}
			_skin.warddec.text = str;
			
			_skin.warddec.mouseEnabled = false;
			arr = $vo.giftbag;
			
			len = arr.length;
			var item:GoodItem
			_awardVec = new Vector.<GoodItem>();
			for(i = 0;i < len;i++)
			{
				item = new GoodItem();
				item.initUI();
				item.data = arr[i].goods;
				item.showNum(arr[i].num);
				this.addChild(item);
				item.x = 468 + (item.width + 3)* i;
				item.y = 4;
				_awardVec.push(item);
			}
			
		}
		
		private  function setGoodsItem():void
		{
			
		}
		public function addEvtListener():void
		{
		}
		
		public function removeEvtListener():void
		{
		}
		
		public function destroyView():void
		{
			while(_awardVec.length)
			{
				_awardVec.pop().destroyView();
			}
			_awardVec = null;
		}
	}
}